$('#fp_cgjsd_tab').tabs({
    border:false,
    onSelect:function (title) {
        if (title == "采购结算单打印") {
            $.ajax({
                type:"POST",
                url:$.webPath() + '/jsgl/fp/fpcgjsdDetail?fpcgjsdId=' + $("#fp_cgjsd_detail_id").val(),
                dataType:"html",
                beforeSend:function () {
                    $.messager.progress();
                },
                success:function (data) {
                    $.messager.progress("close");
                    $('#cgjsddy_cgjsd_id').html(data);
                    if (data.statusCode == 300) {
                    }
                    if (data.statusCode == 200) {
                    }
                }
            });
        }
    }
});

$(function(){
    $("#fp_cgjsd_jsdmx_table").datagrid({
        onLoadSuccess:function(){
            $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
        }
    })
})

// 采购结算单打印预览
function fp_cgjsd_dyPrintPreview() {
    var LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
    LODOP.SET_PRINT_STYLEA(0, "NotOnlyHighPrecision", true);
    LODOP.PRINT_INIT("预览采购结算单");
    //LODOP.SET_PRINT_PAGESIZE(2);
    var strBodyStyle = "<style  type=\"text/css\">" +
        ".textcon{padding:8px;}" +
        ".input-tian{border-top:0 none;border-left:0 none;border-right:0 none;border-bottom: 1px solid black;height:22px;line-height:22px;width:100%;font-weight: bold;}" +
        " select{display:none}" +
        ".tb{width:auto;border-collapse:collapse;border-spacing:0;}" +
        ".tb th{padding:2px 2px 2px 12px;font-size:12px;font-weight:normal;text-align: right;}" +
        ".tb td{padding:2px;font-size:12px;}" +
        ".tb caption{ font-size:24px;height:40px;line-height:20px;}" +
        ".intb{width: 100%;}" +
        ".intb,.intb th,.intb td{border:1px solid black;}" +
        "</style>";
    var strFormHtmltop = strBodyStyle + "<div class='textcon'>" + document.getElementById("cgjsddy_print_id").innerHTML + "</div>";
    var strFormHtmlbody = strBodyStyle +"<div class='textcon'>" + document.getElementById("cgjsddy_cgjsd_id").innerHTML + "</div>";
    var strFormHtmlBottom = strBodyStyle +"<div class='textcon'>" + document.getElementById("cgjsddy_detail_id").innerHTML + "</div>";

    LODOP.ADD_PRINT_TABLE(120, "1.5%", "90%", 350, strFormHtmlbody);
    LODOP.SET_PRINT_STYLEA(0,"Vorient",3);
    LODOP.ADD_PRINT_HTM(20, "1.5%", "90%", 130, strFormHtmltop);
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
    LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);
    LODOP.ADD_PRINT_HTM(495, "1.5%", "90%", 200, strFormHtmlBottom);
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
    LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);
    LODOP.ADD_PRINT_TEXT(5,"80%",135,20,"总页号：第#页/共&页");
    LODOP.SET_PRINT_STYLEA(0,"ItemType",2);
    LODOP.SET_PRINT_STYLEA(0,"Horient",1);
    LODOP.PREVIEW();
}

//采购结算单打印
function fp_cgjsd_dyPrint() {
    var LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));

    LODOP.SET_PRINT_STYLEA(0, "NotOnlyHighPrecision", true);
    LODOP.PRINT_INIT("打印采购结算单");
    //LODOP.SET_PRINT_PAGESIZE(2);
    LODOP.SET_PRINT_STYLE("FontSize", 18);

    var inputs = document.getElementById("cgjsddy_id").getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        inputs[i].setAttribute("value", inputs[i].value);
    }
    var strBodyStyle = "<style type=\"text/css\">" +
        ".textcon{padding:8px;}" +
        ".input-tian{border-top:0 none;border-left:0 none;border-right:0 none;border-bottom: 1px solid black;height:22px;line-height:22px;width:100%;font-weight: bold;}" +
        " select{display:none}" +
        ".tb{width:auto;border-collapse:collapse;border-spacing:0;}" +
        ".tb th{padding:2px 2px 2px 12px;font-size:12px;font-weight:normal;text-align: right;}" +
        ".tb td{padding:2px;font-size:12px;}" +
        ".tb caption{ font-size:24px;height:60px;line-height:20px;}" +
        ".intb{width: 100%;}" +
        ".intb,.intb th,.intb td{border:1px solid black;}" +
        //".input-tian{border-top-style:none;border-left-style:none;border-right-style:none;border-bottom-style: 1px solid #57626a;height:22px;line-height:22px;width:100%;color:#485f71;font-weight: bold;background: #F6F9FF;}," +
        //".tb{width:auto;border-collapse:collapse;border-spacing:0;color:#485f71;}," +
        //".tb th{padding:2px 2px 2px 12px;font-weight:normal;text-align: right;}," +
        //".tb td{padding:2px;},.tb caption{ font-size:24px;height:70px;line-height:30px;}" +
        "</style>";
    var strFormHtml = strBodyStyle + "<body>" + document.getElementById("cgjsddy_print_id").innerHTML + document.getElementById("cgjsddy_cgjsd_id").innerHTML + document.getElementById("cgjsddy_detail_id").innerHTML + "</body>";
    LODOP.ADD_PRINT_HTM(80, 40, 1042, 585, strFormHtml);

    LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT", "Auto-Width");
    LODOP.SET_PRINT_STYLEA(0, "QRCodeVersion", 3);
    LODOP.PRINT();
}